package com.song.service.imlp;

import com.song.mapper.EmpMapper;
import com.song.pojo.JobOption;
import com.song.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class ReportServiceImlp implements ReportService {
    @Autowired
    private EmpMapper empMapper;
    @Override
    public JobOption getJobOption() {
        List<Map<String,Object>> list = empMapper.getJobOption();
        log.info("获取员工数据统计{}", list);
        List<String> jobList = list.stream().map(map -> map.get("job").toString()).toList();
        List<Integer> dataList = list.stream().map(map -> ((Long) map.get("num")).intValue()).toList();
//        log.info("获取员工数据统计jobList{}", jobList);
//        log.info("获取员工数据统计dataList{}", dataList);


        return new JobOption(jobList,dataList);
    }

    @Override
    public List<Map<String, Object>> getEmpJobGender() {

        return empMapper.getGenderCount();
    }
}
